/**
 * VUEshop
 * ============================================================================
 * * 版权所有 2015-2027 深圳搜豹网络科技有限公司，并保留所有权利。
 * 网站地址: http://www.vueshop.com.cn
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: soubao-java 2020-07-22 $
 */<template>
  <div>
    <div
      id="explanation"
      class="explanation"
      style="color: rgb(85, 85, 85); background-color: rgb(243, 244, 244); width: 98%; height: 100%;"
    >
      <div class="bckopa-tips">
        <div class="title">
          <img src="@/static/images/handd.png" alt />
          <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
        </div>
        <ul>
          <li>网站全局基本设置，商城及其他模块相关内容在其各自栏目设置项内进行操作。</li>
        </ul>
      </div>
      <span title="收起提示" id="explanationZoom" style="display: block;"></span>
    </div>

    <el-form ref="form" :model="form" label-width="200px" label-position="right">
      <el-form-item label="会员注册赠送积分">
        <el-input v-model="form.reg_integral" size="mini"></el-input>
        <p class="notic">会员注册赠送积分</p>
      </el-form-item>
      <el-form-item label="附件上传大小限制">
        <el-select v-model="form.file_size" placeholder="请选择附件上传大小限制" size="mini">
          <el-option label="1M" value="1"></el-option>
          <el-option label="2M" value="2"></el-option>
          <el-option label="3M" value="3"></el-option>
          <el-option label="5M" value="5"></el-option>
          <el-option label="10M" value="10"></el-option>
          <el-option label="50M" value="50"></el-option>
          <el-option label="100M" value="100"></el-option>
        </el-select>
        <p class="notic">附件上传大小限制</p>
      </el-form-item>
      <el-form-item label="默认库存">
        <el-input v-model="form.default_storage" size="mini"></el-input>
        <p class="notic">添加商品的默认库存</p>
      </el-form-item>
      <el-form-item label="发票税率(%)">
        <el-input v-model="form.tax" size="mini"></el-input>
        <p class="notic">当买家需要发票的时候就要增加[商品金额]*[税率]的费用</p>
      </el-form-item>
      <el-form-item label="首页热门搜索词">
        <el-input v-model="form.hot_keywords" size="mini"></el-input>
        <p class="notic">首页或手机搜索页，搜索栏下侧显示</p>
      </el-form-item>
      <el-form-item label="浏览器端百度ak">
        <el-input v-model="form.bd_ak" size="mini"></el-input>
        <p class="notic">
          用于浏览器
          <a
            href="http://lbsyun.baidu.com/index.php?title=jspopular/guide/introduction"
            target="_blank"
          >去申请百度ak</a>,认证成功调用次数多些。
        </p>
      </el-form-item>
      <el-form-item label="服务端百度ak">
        <el-input v-model="form.bd_serverak" size="mini"></el-input>
        <p class="notic">
          用于服务器
          <a
            href="http://lbsyun.baidu.com/index.php?title=jspopular/guide/introduction"
            target="_blank"
          >去申请百度ak</a>
        </p>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit" :loading="subLoading">确认提交</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
	import {
		getConfigs,updateConfigs
	} from "@/utils/api"
export default {
  data() {
    return {
      form: {},
	  subLoading: false,
    };
  },
  components: {},
  created() {
    this.getConfigs();
  },
  methods: {
    getConfigs() {
      var that = this;
        getConfigs({inc_type: "basic"}).then(function(res) {
          that.form = res.basic;
        });
    },
    onSubmit() {
      var that = this;
	  that.subLoading = true
      updateConfigs('basic', that.form).then(function(res) {
		  that.subLoading = false
        if (res.status == 1) {
          that.$message({
            message: "保存成功",
            type: "success"
          });
        } else {
          that.$message({
            showClose: true,
            message: "保存失败,失败原因:" + res.msg,
            type: "error"
          });
        }
      });
    }
  }
};
</script>
<style scoped>
	>>>.el-input--mini .el-input__inner {
		width: 200px;
	}
	>>>.el-select--mini .el-input__inner {
		width: 100px;
	}
</style>
